//
//  RWTabBarButton.m
//  04-ipadQQ
//
//  Created by 紫荆秋雪 on 16/4/7.
//  Copyright © 2016年 紫荆秋雪. All rights reserved.
//

#import "RWTabBarButton.h"

@implementation RWTabBarButton

- (instancetype)initWithFrame:(CGRect)frame{

    self = [super initWithFrame:frame];
    if (self) {
        
        [self setBackgroundImage:[UIImage imageNamed:@"tabbar_separate_selected_bg"] forState:UIControlStateDisabled];
        
        self.imageView.contentMode = UIViewContentModeCenter;
        
        //进入Disable状态下，图片状态不能改变
        self.adjustsImageWhenDisabled = NO;
        
        //进入Highlight状态下，图片状态不能改变
        self.adjustsImageWhenHighlighted = NO;
        
        //

    }
    return self;
}

#pragma mark - 布局Button中 子控件
- (void)layoutSubviews{

    [super layoutSubviews];
    
    if (Lanscape) {
        
        self.imageView.height = self.height;
        self.imageView.width = self.width * 0.4;
        self.imageView.x = 0;
        self.imageView.y = 0;
        
        self.titleLabel.hidden = NO;
        self.titleLabel.y = 0;
        self.titleLabel.x = self.imageView.width;
        self.titleLabel.width = self.width - self.imageView.width;
        self.titleLabel.height = self.height;
        
    }else {
    
        self.titleLabel.hidden = YES;
        self.imageView.frame = self.bounds;
    }
}

#pragma mark -重写highlighted的set方法，表示没有了高亮状态
- (void)setHighlighted:(BOOL)highlighted
{

}

@end
